解決 Claude Code on desktop 無法恢復對話工作階段的問題
TLDR
- 當 OAuth 驗證過期時,Claude Code 會出現 401 錯誤,且
/login指令無法正常運作。 - 此問題為 Claude Desktop (Windows/macOS) 的已知 Bug。
- 臨時解決方案:手動關閉 Claude Desktop 後,重新執行安裝檔即可恢復對話工作階段。
問題現象與成因
什麼情況下會遇到這個問題:當 Claude Code 的 OAuth 驗證狀態因長時間未操作而過期時,嘗試繼續進行對話會觸發錯誤。
當驗證過期後,系統會回傳以下錯誤訊息:
text
API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth token has expired. Please obtain a new token or refresh your existing token."},"request_id":"req_011CWWoXen3mpmsjy27LGmqn"} · Please run /login然而,當使用者依照提示輸入 /login 指令時,會發生以下異常行為:
- 初次輸入指令後,系統無任何視覺回饋。
- 稍作延遲後,系統回報
Unknown slash command: login。
此問題導致當前對話工作階段(Session)無法繼續操作,目前已證實為 Claude Desktop 的已知 Bug,相關討論可參考:
- GitHub Issue #13928: Claude Code for Windows unusable due to OAuth loop
- GitHub Issue #15007: /login Does Not Recover Active Session
臨時解決方案
WARNING
以下為非官方臨時解法,建議持續關注官方更新,等待正式修復。
在官方修正驗證重連機制之前,可透過以下步驟強制恢復操作:
- 手動關閉 Claude Desktop 視窗(建議先手動關閉以避免殘留程式干擾)。
- 重新執行
Claude Setup.exe。
執行上述步驟後,對話工作階段即可立即恢復運作,無需重新登入或建立新的對話。
異動歷程
- 初版文件建立。